package edu.njust.Service.consumer.impl;

import edu.njust.Service.consumer.ConsumerService;
import edu.njust.dao.ConsumerMapper;
import edu.njust.domain.Consumer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConsumerServiceImpl implements ConsumerService {

    @Autowired
    private ConsumerMapper consumerMapper;

    @Override
    public boolean deleteById(int id) {
        return consumerMapper.deleteById(id)>0;
    }

    @Override
    public boolean insertAll(Consumer consumer) {
        return consumerMapper.insertAll(consumer)>0;
    }

    @Override
    public Consumer selectById(int id,String pwd) {
        Consumer consumer=consumerMapper.selectById(id,pwd);
        return consumer;
    }

    @Override
    public boolean updateById(Consumer consumer) {
        return consumerMapper.updateById(consumer)>0;
    }

    @Override
    public List<Consumer> pageSelect(String name, int start, int pageSize) {
        List<Consumer> consumers=consumerMapper.pageSelect(name,start,pageSize);
        return consumers;
    }

    @Override
    public int countSelect(String name) {
        return consumerMapper.countSelect(name);
    }

    @Override
    public boolean selectYZ(String papersNumber) {
        return consumerMapper.selectYZ(papersNumber)>0;
    }
}
